package com.hbk.gen;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import com.hbk.programe.Field;

public class Pojo {
	
	private String clazz;

	private String table;

	private String alias;

	private String comment;

	private List<Field> fields = new ArrayList<Field>();

	public String getClazz() {
		return clazz;
	}

	public void setClazz(String clazz) {
		this.clazz = clazz;
	}

	public String getTable() {
		return table;
	}

	public void setTable(String table) {
		this.table = table;
	}

	public String getAlias() {
		return alias;
	}

	public void setAlias(String alias) {
		this.alias = alias;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public List<Field> getFields() {
		return fields;
	}

	public void setFields(List<Field> fields) {
		this.fields = fields;
	}
	
	public Set<String> getImports() {
		Set<String> list = new HashSet<>();
		for (Field field : fields) {
			if (field.getType().equals("BigDecimal")) {
				list.add("import java.math.BigDecimal;");
			}
			if (field.getType().equals("Date")) {
				list.add("import java.util.Date;");
			}
			if (field.getType().contains("List")) {
				list.add("import java.util.List;");
				list.add("import java.util.ArrayList;");
			}
			if (field.getType().equals("Set")) {
				list.add("import java.util.Set;");
				list.add("import java.util.HashSet;");
			}
		}
		return list;
	}

}
